VERSION 5.00
Object = "{00025600-0000-0000-C000-000000000046}#5.2#0"; "crystl32.ocx"
Object = "{67397AA1-7FB1-11D0-B148-00A0C922E820}#6.0#0"; "MSADODC.OCX"
Object = "{F0D2F211-CCB0-11D0-A316-00AA00688B10}#1.0#0"; "MSDATLST.OCX"
Begin VB.Form FrmReceived 
   BackColor       =   &H8000000D&
   BorderStyle     =   1  'Fixed Single
   Caption         =   "Automatic Received"
   ClientHeight    =   1860
   ClientLeft      =   2760
   ClientTop       =   3750
   ClientWidth     =   4680
   ControlBox      =   0   'False
   FillColor       =   &H00FF0000&
   ForeColor       =   &H8000000B&
   LinkTopic       =   "Form1"
   MaxButton       =   0   'False
   MinButton       =   0   'False
   ScaleHeight     =   1860
   ScaleWidth      =   4680
   Begin VB.TextBox Text1 
      DataField       =   "WMDSC"
      DataSource      =   "Adodc2"
      Height          =   285
      Left            =   3000
      TabIndex        =   7
      Text            =   "Text1"
      Top             =   840
      Width           =   1575
   End
   Begin MSAdodcLib.Adodc Adodc2 
      Height          =   375
      Left            =   2400
      Top             =   0
      Visible         =   0   'False
      Width           =   1935
      _ExtentX        =   3413
      _ExtentY        =   661
      ConnectMode     =   0
      CursorLocation  =   3
      IsolationLevel  =   -1
      ConnectionTimeout=   15
      CommandTimeout  =   30
      CursorType      =   3
      LockType        =   3
      CommandType     =   2
      CursorOptions   =   0
      CacheSize       =   50
      MaxRecords      =   0
      BOFAction       =   0
      EOFAction       =   0
      ConnectStringType=   1
      Appearance      =   1
      BackColor       =   -2147483643
      ForeColor       =   -2147483640
      Orientation     =   0
      Enabled         =   -1
      Connect         =   ""
      OLEDBString     =   ""
      OLEDBFile       =   ""
      DataSourceName  =   "BML"
      OtherAttributes =   ""
      UserName        =   ""
      Password        =   ""
      RecordSource    =   ""
      Caption         =   "Adodc2"
      BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
         Name            =   "MS Sans Serif"
         Size            =   8.25
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      _Version        =   393216
   End
   Begin MSDataListLib.DataCombo DCmbWhC 
      Bindings        =   "FrmReceived.frx":0000
      DataField       =   "WMWHC"
      DataSource      =   "Adodc2"
      Height          =   315
      Left            =   2040
      TabIndex        =   6
      Top             =   840
      Width           =   855
      _ExtentX        =   1508
      _ExtentY        =   556
      _Version        =   393216
      ListField       =   "WMWHC"
      BoundColumn     =   "WMWHC"
      Text            =   ""
   End
   Begin VB.CommandButton CmdAccept 
      Caption         =   "Accept"
      Height          =   375
      Left            =   1635
      TabIndex        =   4
      Top             =   1320
      Width           =   1335
   End
   Begin VB.CommandButton CmdPreview 
      Caption         =   "&Preview"
      Height          =   375
      Left            =   240
      TabIndex        =   3
      Top             =   1320
      Width           =   1335
   End
   Begin VB.CommandButton CmdExit 
      Caption         =   "Exit"
      Height          =   375
      Left            =   3075
      TabIndex        =   2
      Top             =   1320
      Width           =   1335
   End
   Begin MSAdodcLib.Adodc Adodc1 
      Height          =   375
      Left            =   240
      Top             =   0
      Visible         =   0   'False
      Width           =   1215
      _ExtentX        =   2143
      _ExtentY        =   661
      ConnectMode     =   0
      CursorLocation  =   3
      IsolationLevel  =   -1
      ConnectionTimeout=   15
      CommandTimeout  =   30
      CursorType      =   3
      LockType        =   3
      CommandType     =   1
      CursorOptions   =   0
      CacheSize       =   50
      MaxRecords      =   0
      BOFAction       =   0
      EOFAction       =   0
      ConnectStringType=   1
      Appearance      =   1
      BackColor       =   -2147483643
      ForeColor       =   -2147483640
      Orientation     =   0
      Enabled         =   -1
      Connect         =   ""
      OLEDBString     =   ""
      OLEDBFile       =   ""
      DataSourceName  =   "BML"
      OtherAttributes =   ""
      UserName        =   ""
      Password        =   ""
      RecordSource    =   ""
      Caption         =   "Adodc1"
      BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
         Name            =   "MS Sans Serif"
         Size            =   8.25
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      _Version        =   393216
   End
   Begin Crystal.CrystalReport CrystalReport1 
      Left            =   1560
      Top             =   0
      _ExtentX        =   741
      _ExtentY        =   741
      _Version        =   348160
      PrintFileLinesPerPage=   60
   End
   Begin MSDataListLib.DataCombo DCmbDoNo 
      Bindings        =   "FrmReceived.frx":0015
      DataSource      =   "Adodc1"
      Height          =   315
      Left            =   2040
      TabIndex        =   0
      Top             =   360
      Width           =   2055
      _ExtentX        =   3625
      _ExtentY        =   556
      _Version        =   393216
      ListField       =   "doc"
      Text            =   ""
   End
   Begin VB.Label Label1 
      BackColor       =   &H8000000D&
      Caption         =   "Move to"
      BeginProperty Font 
         Name            =   "VNI-Helve"
         Size            =   9
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   -1  'True
         Strikethrough   =   0   'False
      EndProperty
      ForeColor       =   &H0000FFFF&
      Height          =   375
      Index           =   1
      Left            =   360
      TabIndex        =   5
      Top             =   840
      Width           =   1455
   End
   Begin VB.Label Label1 
      BackColor       =   &H8000000D&
      Caption         =   "Document No."
      BeginProperty Font 
         Name            =   "VNI-Helve"
         Size            =   9
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   -1  'True
         Strikethrough   =   0   'False
      EndProperty
      ForeColor       =   &H0000FFFF&
      Height          =   375
      Index           =   0
      Left            =   360
      TabIndex        =   1
      Top             =   360
      Width           =   1455
   End
End
Attribute VB_Name = "FrmReceived"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False

Option Explicit

Private Sub Command3_Click()
Unload Me
End Sub

Private Sub CmdAccept_Click()
  Dim Objcmd As Command
    Set Objcmd = New ADODB.Command
    Objcmd.CommandText = "AutoReceiving"
    Objcmd.CommandType = adCmdStoredProc
            
    ' Connect to the data source.
   'Set objConn = GetNewConnection
    Set Objcmd.ActiveConnection = DBconn
        
    ' Automatically fill in parameter info from stored procedure.
    Objcmd.Parameters.Refresh
    
    ' Set the param value.
    Objcmd(1) = UserLogin
    Objcmd(2) = DCmbDoNo.BoundText
    Objcmd(3) = DCmbWhC.BoundText
    Objcmd(4) = "1111"
    ' Execute once and display...
    Objcmd.Execute
    MsgBox "Success"
    DCmbDoNo.BoundText = ""
    Adodc1.Refresh
End Sub

Private Sub DataCombo2_Click(Area As Integer)
  
    Adodc2.Refresh
End Sub

Private Sub cmdexit_Click()
    Unload Me
End Sub

Private Sub CmdPreview_Click()
    Dim ReportName As String
 
    ReportName = "receivereport.rpt"
    If DCmbDoNo.BoundText = "" Or IsNull(DCmbDoNo.BoundText) Then
        MsgBox "You must chose DocNo."
        Exit Sub
    Else
     CrystalReport1.ReportFileName = DDAN & "\" & ReportName
     CrystalReport1.RetrieveStoredProcParams
     CrystalReport1.StoredProcParam(0) = DCmbDoNo.BoundText
     CrystalReport1.Action = 1
     End If
End Sub

Private Sub OpenFile()
    Adodc1.ConnectionString = ConnectString
    Adodc1.ConnectionTimeout = 10
    Adodc1.CommandType = adCmdText
    Adodc1.RecordSource = "SELECT DCDOC AS doc From IDC WHERE(DCPRT = 'N')"
    Adodc1.Refresh
    Adodc2.ConnectionString = ConnectString
    Adodc2.ConnectionTimeout = 10
    Adodc2.CommandType = adCmdTable
    Adodc2.RecordSource = "IWM"
    Adodc2.Refresh
End Sub

Private Sub Form_Load()
    OpenFile
End Sub
